HAL GFXMMU I/O operations migration

This section provides information about the HAL GFXMMU function migration.

HAL GFXMMU configure force cache behavior

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXMMU_ConfigForceCache(GFXMMU_HandleTypeDef *hgfxmmu, uint32_t ForceParam);
hal_status_t HAL_GFXMMU_InvalidateCache(hal_gfxmmu_handle_t *hgfxmmu);

hal_status_t HAL_GFXMMU_CleanCache(hal_gfxmmu_handle_t *hgfxmmu);

hal_status_t HAL_GFXMMU_CleanInvalidateCache(hal_gfxmmu_handle_t *hgfxmmu);

Usage example:

HAL_GFXMMU_ConfigForceCache(&hgfxmmu, GFXMMU_CACHE_FORCE_INVALIDATE);
HAL_GFXMMU_ConfigForceCache(&hgfxmmu, GFXMMU_CACHE_FORCE_FLUSH);
HAL_GFXMMU_ConfigForceCache(&hgfxmmu, (GFXMMU_CACHE_FORCE_FLUSH |GFXMMU_CACHE_FORCE_INVALIDATE));

Usage example:

HAL_GFXMMU_InvalidateCache(&hgfxmmu);
HAL_GFXMMU_CleanCache(&hgfxmmu);
HAL_GFXMMU_CleanInvalidateCache(&hgfxmmu);

Related use cases: Use case: GFXMMU configuration


HAL GFXMMU configure a specific LUT line

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXMMU_ConfigLutLine(const GFXMMU_HandleTypeDef *hgfxmmu,
                                           const GFXMMU_LutLineTypeDef *lutLine);

Removed: This API is no more available, all lines of the LUT can be configured with HAL_GFXMMU_SetLUT For more details, refer to HAL GFXMMU configure the lookup table (LUT).


HAL GFXMMU configure the lookup table (LUT)

HAL1

HAL2

In HAL1, the user must enter the first and the last visible pixel for each line using STM32CubeMX to generate the lookup table automatically. The LUT contains the LUTxlow and LUTxhigh values, referring by uint32_t Address.

In HAL2,The LUT (Look-Up Table) is implemented as a union type that combines the raw 32-bit register values (LUTxL and LUTxH) with detailed bitfield structures (lut_low and lut_high). This design provides dual access modes for the user:

  • Raw Access: Direct manipulation of the entire 32-bit register value, useful for efficient register programming.

  • Field Access: Fine-grained access to individual bitfields within the LUT registers, which enhances readability and significantly improves the debugging experience.

By leveraging this approach, the LUT type remains compact and efficient for low-level register operations while offering a more intuitive interface for developers working with specific LUT parameters.

Note

The values in the LUT tables generated by STM32CubeMX are compatible with the HAL2 drivers when accessed through the raw row values.

HAL_StatusTypeDef HAL_GFXMMU_ConfigLut(const GFXMMU_HandleTypeDef *hgfxmmu,
                                       uint32_t FirstLine,
                                       uint32_t LinesNumber,
                                       uint32_t Address);
hal_status_t HAL_GFXMMU_SetLUT(hal_gfxmmu_handle_t *hgfxmmu,
                               const hal_gfxmmu_lut_config_t *p_config);

Usage example:

Usage example:

/* In HAL1 the lut generated using STM32CubeMX contains LutxL and LUTxH that are
   computed from inputs pixel entered by the user,
   for example for the line number 0, the user enters the first visible pixel as 10
   and the last visible pixel as 20;
   Then the LUT0L is 0x00020101 which corresponds to:
           - the lut enabled bit[0]: 0x1,
           - first visible block bits[8:15]:0x01,
           - last visible block bits[16:23]:0x02,
  the LUT0H corresponds to the line offset bits[4:21]with a value of 0x3FFFF
*/

 uint32_t gfxmmu_lut_config[2*10] = {
 0x00020101, //GFXMMU_LUT0L
 0x003FFFF0, //GFXMMU_LUT0H
 0x00020001, //GFXMMU_LUT1L
 0x00000020, //GFXMMU_LUT1H
 0x00030001, //GFXMMU_LUT2L
 0x00000050, //GFXMMU_LUT2H
 0x00030001, //GFXMMU_LUT3L
 0x00000090, //GFXMMU_LUT3H
 0x00030001, //GFXMMU_LUT4L
 0x000000D0, //GFXMMU_LUT4H
 0x00030001, //GFXMMU_LUT5L
 0x00000110, //GFXMMU_LUT5H
 0x00030001, //GFXMMU_LUT6L
 0x00000150, //GFXMMU_LUT6H
 0x00030001, //GFXMMU_LUT7L
 0x00000190, //GFXMMU_LUT7H
 0x00030001, //GFXMMU_LUT8L
 0x000001D0, //GFXMMU_LUT8H
 0x00030001, //GFXMMU_LUT9L
 0x00000210, //GFXMMU_LUT9H
 0x00030001, //GFXMMU_LUT10L
 0x00000250, //GFXMMU_LUT10H
 0x00030001, //GFXMMU_LUT11L
 0x00000290, //GFXMMU_LUT11H
 0x00030001, //GFXMMU_LUT12L
 0x000002D0, //GFXMMU_LUT12H
 0x00030001, //GFXMMU_LUT13L
 0x00000310, //GFXMMU_LUT13H
 0x00030001, //GFXMMU_LUT14L
 0x00000350, //GFXMMU_LUT14H
 0x00030001, //GFXMMU_LUT15L
 0x00000390, //GFXMMU_LUT15H
 0x00030001, //GFXMMU_LUT16L
 0x000003D0, //GFXMMU_LUT16H
 0x00030001, //GFXMMU_LUT17L
 0x00000410, //GFXMMU_LUT17H
 0x00020001, //GFXMMU_LUT18L
 0x00000450, //GFXMMU_LUT18H
 0x00020001, //GFXMMU_LUT19L
 0x00000480};//GFXMMU_LUT19H

 HAL_GFXMMU_ConfigLut(&GfxmmuHandle,
                       0,
                       20,
                       (uint32_t) gfxmmu_lut_config);
/* In HAL2 the lut generated using STM32CubeMX2 containing the union of LutxL and LUTxH
   computed from the circular shape inputs with a radius of 10, and x and y coordinates
   both set to 10.
   Then the LUT0L is 0x00020101 which corresponds to:
           - the lut enabled bit[0]: 0x1,
           - first visible block bits[8:15]:0x01,
           - last visible block bits[16:23]:0x02,
  the LUT0H corresponds to the line offset bits[4:21]with a value of 0x3FFFF
*/

 hal_gfxmmu_lut_t gfxmmu_lut_config[5] = {
 {0x00020101, // GFXMMU_LUT0L
 0x003FFFF0}, // GFXMMU_LUT0H
 {0x00020001, // GFXMMU_LUT1L
 0x20},       // GFXMMU_LUT1H
 {0x00020001, // GFXMMU_LUT2L
 0x50},       // GFXMMU_LUT2H
 {0x00030001, // GFXMMU_LUT3L
 0x80},       // GFXMMU_LUT3H
 {0x00030001, // GFXMMU_LUT4L
 0xC0},       // GFXMMU_LUT4H
 {0x00030001, // GFXMMU_LUT5L
 0x100},      // GFXMMU_LUT5H
 {0x00030001, // GFXMMU_LUT6L
 0x140},      // GFXMMU_LUT6H
 {0x00030001, // GFXMMU_LUT7L
 0x180},      // GFXMMU_LUT7H
 {0x00030001, // GFXMMU_LUT8L
 0x1C0},      // GFXMMU_LUT8H
 {0x00030001, // GFXMMU_LUT9L
 0x200},      // GFXMMU_LUT9H
 {0x00030001, // GFXMMU_LUT10L
 0x240},      // GFXMMU_LUT10H
 {0x00030001, // GFXMMU_LUT11L
 0x280},      // GFXMMU_LUT11H
 {0x00030001, // GFXMMU_LUT12L
 0x2C0},      // GFXMMU_LUT12H
 {0x00030001, // GFXMMU_LUT13L
 0x300},      // GFXMMU_LUT13H
 {0x00030001, // GFXMMU_LUT14L
 0x340},      // GFXMMU_LUT14H
 {0x00030001, // GFXMMU_LUT15L
 0x380},      // GFXMMU_LUT15H
 {0x00030001, // GFXMMU_LUT16L
 0x3C0},      // GFXMMU_LUT16H
 {0x00030001, // GFXMMU_LUT17L
 0x400},      // GFXMMU_LUT17H
 {0x00020001, // GFXMMU_LUT18L
 0x440},      // GFXMMU_LUT18H
 {0x00020001, // GFXMMU_LUT19L
 0x470}};     // GFXMMU_LUT19H

 hal_gfxmmu_lut_config_t basic_lut_config;
 basic_lut_config.first_line = 0;
 basic_lut_config.lut_size_lines = 20;
 basic_lut_config.lut = gfxmmu_lut_config;
 HAL_GFXMMU_SetLUT(&hGFXMMU, &basic_lut_config);

Related use cases: Use case: GFXMMU configuration


HAL GFXMMU disables specific LUT lines

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXMMU_DisableLutLines(const GFXMMU_HandleTypeDef *hgfxmmu,
                                             uint32_t FirstLine,
                                             uint32_t LinesNumber);
hal_status_t HAL_GFXMMU_ResetLutLines(hal_gfxmmu_handle_t *hgfxmmu,
                                      uint32_t start_line,
                                      uint32_t lines_nbr);

HAL GFXMMU modify the address cache configuration

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXMMU_ModifyAddressCache(GFXMMU_HandleTypeDef *hgfxmmu,
                                                GFXMMU_AddressCacheTypeDef *AddressCache);
hal_status_t HAL_GFXMMU_EnableCache(hal_gfxmmu_handle_t *hgfxmmu);
hal_status_t HAL_GFXMMU_DisableCache(hal_gfxmmu_handle_t *hgfxmmu);

hal_status_t HAL_GFXMMU_EnableCacheLockBuff(hal_gfxmmu_handle_t *hgfxmmu, hal_gfxmmu_buff_t buff);
hal_status_t HAL_GFXMMU_DisableCacheLockBuff(hal_gfxmmu_handle_t *hgfxmmu);

Usage example:

GFXMMU_AddressCacheTypeDef AddressCache;
/* Enable address cache */
AddressCache.Activation             = ENABLE;
AddressCache.AddressCacheLockBuffer = GFXMMU_ADDRESSCACHE_LOCK_BUFFER3;
HAL_GFXMMU_ModifyAddressCache(&GfxmmuHandle, &AddressCache);
 /* Disable address cache */
AddressCache.Activation             = DISABLE;
HAL_GFXMMU_ModifyAddressCache(&GfxmmuHandle, &AddressCache);

Usage example:

/* Enable address cache */
HAL_GFXMMU_EnableCache(&hgfxmmu);
HAL_GFXMMU_EnableCacheLockBuff(&hgfxmmu, HAL_GFXMMU_BUFF_3);

/* Disable address cache */
HAL_GFXMMU_DisableCache(&hgfxmmu);
HAL_GFXMMU_DisableCacheLockBuff(&hgfxmmu);

Related use cases: Use case: GFXMMU configuration


HAL GFXMMU modify buffer configurations

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXMMU_ModifyBuffers(GFXMMU_HandleTypeDef *hgfxmmu,
                                            const GFXMMU_BuffersTypeDef *Buffers);
hal_status_t HAL_GFXMMU_SetBuffPhysicalAddr(hal_gfxmmu_handle_t *hgfxmmu,
                                            hal_gfxmmu_buff_t buff,
                                            uint32_t buff_physical_addr);

Usage example:

 /* initialize buffers structure with addresses */
 GFXMMU_BuffersTypeDef Buffers;
 Buffers.Buf0Address = 0xABABABA0;
 Buffers.Buf1Address = 0xCDCDCDC0;
 Buffers.Buf2Address = 0xEFEFEFE0;
 Buffers.Buf3Address = 0x12121210;
HAL_GFXMMU_ModifyBuffers(&hgfxmmu, &Buffers);

Usage example:

HAL_GFXMMU_SetBuffPhysicalAddr(&hgfxmmu, HAL_GFXMMU_BUFF_0,0xABABABA0);
HAL_GFXMMU_SetBuffPhysicalAddr(&hgfxmmu, HAL_GFXMMU_BUFF_1,0xCDCDCDC0);
HAL_GFXMMU_SetBuffPhysicalAddr(&hgfxmmu, HAL_GFXMMU_BUFF_2,0xEFEFEFE0);
HAL_GFXMMU_SetBuffPhysicalAddr(&hgfxmmu, HAL_GFXMMU_BUFF_3,0x12121210);

Related use cases: Use case: GFXMMU configuration


HAL GFXMMU modify cache prefetch settings

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXMMU_ModifyCachePrefetch(GFXMMU_HandleTypeDef *hgfxmmu,
                                                 const GFXMMU_CachePrefetchTypeDef *CachePrefetch);
hal_status_t HAL_GFXMMU_SetConfigCache(hal_gfxmmu_handle_t *hgfxmmu, const hal_gfxmmu_cache_config_t *p_config);

hal_status_t HAL_GFXMMU_EnableCache(hal_gfxmmu_handle_t *hgfxmmu);
hal_status_t HAL_GFXMMU_DisableCache(hal_gfxmmu_handle_t *hgfxmmu);

hal_status_t HAL_GFXMMU_EnableCacheLockBuff(hal_gfxmmu_handle_t *hgfxmmu, hal_gfxmmu_buff_t buff);
hal_status_t HAL_GFXMMU_DisableCacheLockBuff(hal_gfxmmu_handle_t *hgfxmmu);

hal_status_t HAL_GFXMMU_EnablePrefetch(hal_gfxmmu_handle_t *hgfxmmu);
hal_status_t HAL_GFXMMU_DisablePrefetch(hal_gfxmmu_handle_t *hgfxmmu);

hal_status_t HAL_GFXMMU_EnableForceCache(hal_gfxmmu_handle_t *hgfxmmu);
hal_status_t HAL_GFXMMU_DisableForceCache(hal_gfxmmu_handle_t *hgfxmmu);

For more details, refer to HAL GFXMMU cache and prefetch type definition.

Related use cases: Use case: GFXMMU configuration